package basicstruct

//TreeNode defines a binary tree mode.
type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

//CreateTree creates a tree
func CreateTree(nums []int) *TreeNode {
	if len(nums) == 0 {
		return nil
	}
	head := &TreeNode{}
	return head
}

func traverse(root *TreeNode, nums []int) []int {
	if root == nil {
		nums = append(nums, -1)
		return nums
	}

	nums = append(nums, root.Val)
	nums = traverse(root.Left, nums)
	nums = traverse(root.Right, nums)
	return nums
}

//TraverseTree lists tree's values.
func TraverseTree(root *TreeNode) []int {
	nums := []int{}
	nums = traverse(root, nums)
	return nums
}
